<?php

namespace IDock\Insurance\ZYIC\Response;

use IDock\Http\Response;
use IDock\IDock\IDockEnums;
use IDock\Insurance\ZYIC\ZYICEnums;
use IDock\Insurance\ZYIC\Response\AllZYICResponse;
use IDock\Printer\PolicyPaymentPrinter;
use IDock\Printer\preInquiryPrinter;
use IDock\Printer\ProposalStatusPrinter;
use IDock\Printer\VehicleModelPrinter;
use IDock\Printer\VehiclePrinter;

class NonCarPolicyInfoResponse extends AllZYICResponse
{
    /**
     * @var ProposalStatusPrinter $printer
     */
    public $printer = ProposalStatusPrinter::class;

    public function printerInit(): Response
    {
        $body = $this->getBody();
        $data = $body['content'] ?? [];
        $this->printer->policyNo = $data['policyNo'] ?? [];
        if(empty($this->printer->policyNo)){
            $this->printer->statusCode = 'U1';
            $this->setError('获取非车电子保单失败，请稍后重试');
            return $this;
        }
        $this->printer->argc['channelOrderNo'] = $data['channelOrderNo'] ?? '';
        $this->printer->argc['nonCarProposalNo'] = $data['proposalNo'] ?? '';
        //承保
        $this->printer->statusCode = 'U5';
        $this->printer->status = IDockEnums::$underStats[$this->printer->statusCode] ?? '';
        return $this;
    }
}
